#===============
# * 2013 Copyright Matthew Caswell
# * Pool.pl
#-------
# * Pool language translator/compiler.
# * P.O.O.L - Perl Object Oriented Language
#===============

# __START Package
package PoolCompiler::Exception;
# __END Package

# __START Perl
use strict;
use Data::Dumper;
require Exporter;
# __END Perl

# __START Constants
use constant FAILED_TO_OPEN_CLASS => "Could not open class!";
use constant SEMIC_EXPECTED_EOL => "Semicolon (;) expected at end of line!";
use constant UT_IN_EXPORT_DECL => "Unknown type used in export declaration!";
use constant UT_IN_INTERNAL_DECL => "Unknown type used in internal declaration!";
use constant UT_IN_METH_I => "Unknown type used in meth.i(type)!";
use constant UT_IN_METH_E => "Unknown type used in meth.e(type)!";
use constant UT_IN_C_P => "Unknown type used in Console.println!";
use constant STRAY_WRAP => "Stray }!";
use constant UT_IN_THIS_METHOD => "Unknown type used in this.method(method)!";
use constant UT_IN_METHOD => "Unknown type used in method(method)!";
use constant BAD_INLINE_EXIT => "Bad call to __inline.end__ -- Not inside of inline Perl!";
use constant UT_IN_RETURN => "Unknown type used in return(type)!";
use constant EQ_EXPECTED => "Operator (=) expected!";
use constant UT_IN_VAR_DECL => "Unknown type used in variable declaration!";
use constant INTERNAL_ERROR => "Internal compiler error!";
use constant OUTDATED_COMMENT => "Outdated comment delimiter!";
# __END Constants

# __START Exporter
our @ISA = qw(Exporter);
our @EXPORT = qw(
  FAILED_TO_OPEN_CLASS
  SEMIC_EXPECTED_EOL
  UT_IN_EXPORT_DECL
  UT_IN_INTERNAL_DECL
  UT_IN_METH_I
  UT_IN_METH_E
  UT_IN_C_P
  STRAY_WRAP
  UT_IN_THIS_METHOD
  BAD_INLINE_EXIT
  UT_IN_RETURN
  EQ_EXPECTED
  UT_IN_VAR_DECL
  UT_IN_METHOD
  INTERNAL_ERROR
  OUTDATED_COMMENT
);
# __END Exporter

# __START Compiler

# Throw(EXCEPTION, $lineNumber) --  Throws a compiler error
sub Throw($$){
  my($e, $lineNu) = @_;
  
  die "[STDERR] In line $lineNu: $e\n";
}

# __END Compiler
1;
